
//
//  LLSignInView.m
//  LoveLove
//
//  Created by 达迩科技 on 2019/4/12.
//  Copyright © 2019 wkf. All rights reserved.
//

#import "LLSignInView.h"

@implementation LLSignInView

- (instancetype)init {
    self = [super init];
    if(self) {
        [self setup];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}

-(void)setup{
    
    LLButton *maskButton = [[LLButton alloc] initWithFrame:self.bounds];
    maskButton.backgroundColor = LLColor(36, 42, 52);
    [maskButton addTarget:self action:@selector(didSelectCancle) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:maskButton];
    
    UIView *bgview = [[UIView alloc] initWithFrame:CGRectMake(32, LLScreenHeight/2-396/2, LLScreenWidth-64, 396)];
    bgview.layer.masksToBounds = YES;
    bgview.layer.cornerRadius = 10;
    bgview.backgroundColor = LLWhiteColor;
    [self addSubview:bgview];
    
    UIImageView *bgImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, bgview.width, 177)];
    bgImage.image = [UIImage imageNamed:@"组 1"];
    [bgview addSubview:bgImage];
    
    UIImageView *bgImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(bgview.width/2-126/2, 37, 126, 126)];
    bgImage1.image = [UIImage imageNamed:@"组 2"];
    [bgview addSubview:bgImage1];
    
    self.daysLabel = [LLInitBaseViewTool labelWithText:@"第3天" textColor:LLWhiteColor font:20 textAlignment:NSTextAlignmentCenter];
    self.daysLabel.frame = CGRectMake(0, 0, 126, 126);
    [bgImage1 addSubview:self.daysLabel];
    
    
    UILabel *label1 = [LLInitBaseViewTool labelWithText:@"签到有礼" textColor:LLColor(223, 2, 2) font:19 textAlignment:NSTextAlignmentCenter];
    label1.frame = CGRectMake(0, 205, bgview.width, 19);
    [bgview addSubview:label1];
    
    UILabel *label2 = [LLInitBaseViewTool labelWithText:@"连续签到7天积分可翻倍" textColor:LLColorRGB(102) font:19 textAlignment:NSTextAlignmentCenter];
    label2.frame = CGRectMake(0, 247, bgview.width, 19);
    [bgview addSubview:label2];
    NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:label2.text];
    NSRange range1 = [label2.text rangeOfString:@"7"];
    [AttributedStr addAttribute:NSForegroundColorAttributeName value:LLColor(223, 2, 2) range:range1];
    label2.attributedText = AttributedStr;
    
    LLButton *signButton = [LLInitBaseViewTool buttonWithTitle:@"签到成功" image:nil titleColor:LLWhiteColor font:18];
    signButton.backgroundColor = LLColor(255, 33, 33);
    [signButton addTarget:self action:@selector(didSelecttype) forControlEvents:UIControlEventTouchUpInside];
    signButton.frame = CGRectMake(bgview.width/2-195/2, 311, 195, 59);
    signButton.layer.masksToBounds = YES;
    signButton.layer.cornerRadius = 29.5;
    [bgview addSubview:signButton];
    
    
}

- (void)didSelecttype{
    if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectButton:)]) {
        [self.delegate didSelectButton:self];
    }
}

- (void)didSelectCancle{
    self.hidden = YES;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
